package org.leiyang.service.impl;

import org.leiyang.common.service.RemoteCall;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

/**
 * 非Feign方式的远程调用
 */
@Service
public class RemoteCallImpl extends RemoteCall{
    private final Logger logger = LoggerFactory.getLogger(getClass());

    public Mono<Boolean> removeOfflineClient(String serverIpPort, String clientId){
        logger.info("开始执行远程调用/local/remove/client接口.");
//        MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
//        params.add("clientId", clientId);
        return gotCahcedWebClient(serverIpPort)
                .post()
                .uri("/local/remove/client")
                .contentType(MediaType.APPLICATION_JSON)
                .bodyValue(clientId)
                .retrieve()
                .bodyToMono(Boolean.class);
    }

}
